package com.linjiahao.userCenter.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

/**
 * @ClassName ChatFriend
 * @TableName chat_friend
 * @Description: 实体类
 * @Author linjiahao
 * @Date 6/1/2022
 **/
@TableName(value ="chat_friend")
@Data
public class ChatFriend implements Serializable {

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 自增id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 业务id
     */
    private String bizId;

    /**
     * 用户id
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long userId;

    /**
     * 好友id
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long friendId;

    /**
     * 是否置顶 0：否  1：是
     */
    private Integer isTop;

    /**
     * 是否消息免打扰 0：否  1：是
     */
    private Integer notReceiveMessage;

    /**
     * 好友备注
     */
    private String remark;

    /**
     * 申请填写内容
     */
    private String applyReason;

    /**
     * 是否申请通过 0：否  1：是
     */
    private Integer isPass;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 是否删除 0：否  1：是
     */
    private Integer isDelete;

    public ChatFriend initChatFriend(Long userId,Long friendId,String applyReason,Integer isPass){
        ChatFriend chatFriend = new ChatFriend();
        chatFriend.setBizId(UUID.randomUUID().toString());
        chatFriend.setUserId(userId);
        chatFriend.setFriendId(friendId);
        chatFriend.setApplyReason(applyReason);
        chatFriend.setIsPass(isPass);
        return chatFriend;
    }


}
